Integration Guide FANUC
Note: Read the Robot communication overview before you read this integration guide.
Note 2: This guide describes the FANUC Robot module BPS 1.12.1 for Bin Picking Studio (BPS) 1.12. We strongly recommend that you use the latest version of the Robot module. You can download the Robot module from the official Photoneo website. Supported versions of all Robot modules are listed in the Robot module support matrix.
Contents
1 Prerequisites
Before the setup, make sure that your robot controller meets these requirements:
Controller software: FANUC controller with system software V8.30 - V9.40 (the Robot module contains KAREL binaries for V8.x and V9.x).
To check the system version, go to Menu -> Next -> Status -> Version ID.
Older versions (V6.40 - V8.20) need a custom build of the KAREL binaries and older TP syntax. For these versions, contact support@photoneo.com.
Option R648 User Socket Msg - TCP/IP socket communication with the vision controller.
Option R632 KAREL - the communication with the vision controller is written in KAREL and runs as compiled
.PCprograms.
To check that the options are installed, go to Menu -> Next -> Status -> Version ID -> Next -> F3[ORDER FI]:
At least 120 position registers (see List of used registers).
2 Robot controller setup
2.1 Controller configuration
2.1.1 Setting the IP addresses of the Ethernet ports
Configure the IP address of the controller port that is connected to the vision controller (directly or through a switch).
On the teach pendant, press Menu -> Setup -> Host Comm -> TCP/IP -> F3[Detail]:
Press F3[PORT] to switch between Port#1 and Port#2. Set the IP address and subnet mask of the port to match your network:
If you use ROBOGUIDE or transfer files over the network, you can use the second port for this:
Example of a matching network configuration:
Vision controller:
192.168.1.1 / 255.255.255.0Robot controller:
192.168.1.2 / 255.255.255.0
To check the connection, ping the vision controller from the PING screen of Host Comm (enter the IP address of the vision controller into Remote name/IP and press PING). You can also use Test connection on the Network page of the Studio to ping the robot controller.
2.1.2 Configuring the TCP/IP server
The Robot State Server (KAREL program PHOSTATE) runs on the robot controller as a TCP/IP server. The vision controller connects to it as a client. The server uses Host Comm server tag S3. Tags S1 and S2 stay free for other applications.
Press Menu -> Setup -> Host Comm -> F4[SHOW] and select Servers. Select the S3 tag and press F3[DETAIL]:
Set the tag as follows:
Comment:
PHOSTATEProtocol:
SMStartup State:
START
Do not set the port. When PHOSTATE starts, it writes port 11004 to $HOSTS_CFG[3].$SERVER_PORT itself.
Cycle the power of the robot controller. After the restart, the Current State of S3 must be STARTED.
2.1.3 Configuring the TCP/IP client
The Action Request Client (KAREL program PHOCLIENT) connects to the Action Request Server on the vision controller. The client uses Host Comm client tag C3. Tags C1 and C2 stay free for other applications.
Press Menu -> Setup -> Host Comm -> F4[SHOW] and select Clients. Select the C3 tag and press F3[DETAIL]:
Set the tag as follows:
Comment:
PHOCLIENTProtocol:
SMStartup State:
STARTServer IP/Hostname: IP address of the vision controller (as shown on the Network page of the Studio)
Do not set Remote Port or Port. When PHOCLIENT starts, it writes port 11003 to $HOSTC_CFG[3].$SERVER_PORT itself.
Cycle the power of the robot controller. After the restart, the Current State of C3 must be STARTED.
2.1.4 Changing the Cartesian origin of the robot
BPS uses a robot base frame at the bottom of the robot base (on the J1 axis). The FANUC World frame is higher, at the intersection of J1 and J2. The Robot State Server must report the robot pose in the Photoneo frame. Otherwise, calibration and hand-eye scanning do not work.
To do this, use one user frame and one tool frame:
UFRAME (default User Frame 1) - all values are zero except Z. Set Z to the negative offset of your robot model from the Base frame offsets page.
UTOOL (default Tool Frame 1) - all values are zero (bare flange). You can teach your real gripper TCP in another tool frame.
Press Menu -> Setup -> Frames, press F3[OTHER] and select User Frame:
Edit the Z value of the user frame:
Warning: If you change a user frame, this can affect Cartesian positions that were taught in this frame!
Two registers select the frame numbers. They are set in the TP program PHO_RUN_STATE (default 1 and 1). If you use other frames, edit lines 9 and 11 of PHO_RUN_STATE:
R[33]- UFRAME number:1-9, or0for the World frameR[34]- UTOOL number:1-10, or0for the bare faceplate
The registers always apply. The Robot State Server reads them in every cycle. They do not change the frames that are active for your TP programs. An invalid number is rejected: PHOCLIENT sets R[18] to Bad data (4), and PHOSTATE keeps the active frame and writes a message to the USER screen.
Note: Bin picking trajectories are sent as joint positions, so the frames do not affect the motion of the bin picking routine.
2.2 Robot module installation
2.2.1 Loading the Robot module files
The Robot module archive contains:
Folder / file |
Content |
|---|---|
|
|
|
|
|
|
|
47 TP programs ( |
|
The same 47 TP programs as ASCII text ( |
|
Short instructions and version history |
The TP programs are:
Group |
TP programs |
|---|---|
Request programs (do not edit) |
|
Bin picking procedures |
|
Auxiliary programs |
|
Example programs |
|
Copy the Karel and TP folders to a USB stick and plug it into the teach pendant (UT1:) or into the USB port of the controller cabinet (UD1:).
Press Menu -> File -> File -> F5[UTIL] and select Set Device:
Select the device where the USB stick is plugged in:
Open the Karel folder and then the v8 or v9 folder that matches your controller software. Select PHOCLIENT.PC and press F3[LOAD], then do the same for PHOSTATE.PC.
Open the TP folder, select the item for all TP programs (*.TP or *.*) and press F3[LOAD] to load all TP programs at once:
Press the Select button to check that all TP programs and both KAREL programs are loaded:
Note: Load only the .PC files. The .KL files are source code and cannot be run.
When PHOCLIENT runs for the first time, it writes comments to all registers, flags and position registers used by the Robot module.
3 Robot module
You can integrate the Robot module into your existing TP programs. Two KAREL programs run as background tasks:
PHOCLIENT- the Action Request Client. It sends requests to the vision controller and receives the responses.PHOSTATE- the Robot State Server.
The TP programs of the Robot module communicate with PHOCLIENT through registers and flags. A request program writes the request ID to R[15], sets F[2] and waits until PHOCLIENT resets it. When the response arrives, PHOCLIENT sets F[4].
3.1 Robotic API
Note: Read the Photoneo robotic API before you read this section.
3.1.1 Connection procedures
Command |
Description / Usage |
|---|---|
Connect to Action Request Server
RUN PHOCLIENT |
Description
Starts the KAREL task
PHOCLIENT. The task writes port 11003 to $HOSTC_CFG[3].$SERVER_PORT, pings the vision controller that is set in Host Comm C3 and connects to it. Then it sends the brand ID and sets F[1].Usage
Run it once at the beginning of the main program, after
CALL PHO_CLEAR_VARS. Run it again after the connection is closed (F[1] is OFF). |
Wait for connection to Action Request Server
WAIT (F[1]=ON) |
Description
Waits until the connection is established (flag
F[1: PHO CONNECTED] is ON).Usage
Use it directly after
RUN PHOCLIENT. |
To stop PHOCLIENT, use Function -> Abort All. It also stops by itself after a communication error or a fatal error (see Error handling).
3.1.2 Communication procedures
Note: For a detailed description of the requests, see Action requests.
Warning: Do not edit these TP programs!
Every request writes its error code to R[18: PHO ERROR DATA] (0 = no error). Synchronous programs wait for the response. Asynchronous programs only send the request. The program in the Outputs column receives the response.
TP program |
ID |
Inputs |
Outputs |
|---|---|---|---|
PHO_INIT |
4 |
R[30] - vision system IDR[4] - number of the PR with the start poseR[5] - number of the PR with the end posePR[R[4]], PR[R[5]] - start / end pose (Joint) |
|
PHO_REQ_SCAN |
1 |
|
Asynchronous - call |
PHO_WAIT_SCAN |
- |
- |
|
PHO_TRAJ_REQ |
2 |
|
Asynchronous - call |
PHO_TRAJ_RECV |
- |
- |
R[18]F[7] - pick allowedPHOCLIENT keeps the trajectory, and PHO_PICK_PART executes it. |
PHO_PICK_FAIL |
7 |
|
|
PHO_REQ_OBJ_POSE |
8 |
|
R[18]PR[20] - object pose (Cartesian, mm / deg)R[23] - R[26] - Info data |
PHO_CHANGE_ENV |
15 |
|
|
PHO_REQ_GET_STATUS |
21 |
|
R[18]R[7] - localized objectsR[8] - objects with planned trajectoryR[9] - 1 = still running, 0 = finished |
PHO_REQ_CAPTURE |
28 |
R[30] - vision system IDR[33], R[34] - frames of the sent tool poseF[8] - dynamic meshing ON/OFFR[35] - gap between scans in ms (dynamic meshing) |
Asynchronous - call |
PHO_REQ_REUSE_SCAN |
29 |
|
|
PHO_CHANGE_BBOX |
32 |
R[30] - vision system IDR[37] - bounding box ID |
|
PHO_CALIB_ADD |
5 |
- (the robot pose comes from the Robot State Server) |
|
PHO_CALIB_START |
25 |
R[31] - solution IDR[30] - vision system ID |
|
PHO_CALIB_SAVE |
27 |
- |
R[18]R[32] - calibration accuracy (mm)PR[19] - calibration result pose |
PHO_CALIB_STOP |
26 |
- |
|
PHO_CHANGE_SOL |
9 |
|
|
PHO_REQ_START_SOL |
10 |
|
|
PHO_REQ_STOP_SOL |
11 |
- |
|
PHO_REQ_RUN_SOL |
12 |
- |
R[18]R[31] - running solution ID |
PHO_REQ_COM_CHECK |
100 |
- |
|
|
3 |
|
Reserved for a future Bin localization request. Not supported by BPS 1.12. |
Note: The request Get available solutions (deprecated) is not available in the FANUC Robot module.
3.1.3 Bin picking procedures
Bin picking procedure |
Description / Usage |
|---|---|
Execute bin picking routine
PHO_PICK_PART |
Executes the received bin picking routine - all trajectory segments and gripper commands in the order defined by the grasping method. Do not edit.
Call it after
PHO_TRAJ_RECV returns R[18]=0. The robot must be in the start pose. At the end, the robot is in the end pose with the object in the gripper. If no trajectory was received (F[7] is OFF), the program stops with ABORT.Warning: If you use several vision systems with different start poses, make sure that the robot is in the start pose of the correct vision system.
|
Execute trajectory segment
PHO_EXE_TRAJ |
Moves through the joint waypoints of one trajectory segment ( |
Gripper command switch
PHO_GRIPPER_ACT |
Calls the gripper program selected by |
Gripper attach
PHO_GRIP_ATT |
Empty by default. Add the commands that close the gripper. Called when a waypoint of the grasping method is set to run Attach. |
Gripper detach
PHO_GRIP_DEATT |
Empty by default. Add the commands that open the gripper. Called when the waypoint is set to run Detach. Good practice: run Detach at the start waypoint so that the gripper is open before picking. |
Gripper user-defined 1 - 3
PHO_GRIP_USER1, PHO_GRIP_USER2, PHO_GRIP_USER3 |
Empty by default. Called when the waypoint is set to run User 1, User 2 or User 3. |
3.1.4 Auxiliary procedures
Auxiliary procedure |
Description / Usage |
|---|---|
Clear variables
PHO_CLEAR_VARS |
Resets flags |
Start Robot State Server
PHO_RUN_STATE |
Stops a running |
3.1.5 List of used registers
The Robot module reserves F[1] - F[10], R[1] - R[50] and PR[1] - PR[120]. Do not use them for other purposes. R[38] - R[50] are reserved for future use. PHOCLIENT writes the comments automatically.
Flags
Flag |
Set by |
Description |
|---|---|---|
|
module |
ON while |
|
module |
Set by a request program, reset by |
|
module |
ON while |
|
module |
Set by |
|
module |
The next operation of the bin picking routine is ready (used by |
|
module |
The operation of the bin picking routine is finished (used by |
|
module |
A valid trajectory has been received and |
|
user |
Dynamic meshing. Set it ON before |
|
user |
Set it ON to stop |
|
- |
Deprecated since 1.12.1. Has no effect. |
Registers
Register |
Set by |
Description |
|---|---|---|
|
module |
Number of the trajectory segment being executed (1, 2, …). Used in |
|
|
Speed (%) of the trajectory segment being executed. |
|
module |
Waypoint counter in |
|
user |
Number of the PR with the start pose for |
|
user |
Number of the PR with the end pose for |
|
module |
Current state of |
|
module |
Number of localized objects ( |
|
module |
Number of objects with a planned trajectory ( |
|
module |
|
|
module |
Internal registers of the bin picking routine: total / current operation, trajectory size, last-but-one and last waypoint PR, operation type, gripper command. |
|
module |
ID of the request sent by the last request program. |
|
module |
Error code of the last request ( |
|
user |
Scene state ID for |
|
module |
Info data 1 - 10 ( |
|
user |
Vision system ID used by the next request. |
|
user / module |
Solution ID for |
|
module |
Calibration accuracy in mm (real value), set by |
|
user |
UFRAME used to report the robot pose ( |
|
user |
UTOOL used to report the robot pose ( |
|
user |
Delay between scans in dynamic meshing, in ms ( |
|
module |
Time in ms that the last response took to arrive (diagnostics). |
|
user |
Bounding box ID for |
Position registers
The default number of position registers is often 100. Increase it to at least 120. You do this in a Controlled Start (contact your FANUC support if needed). Be careful - this maintenance operation can delete taught data!
Position register |
Set by |
Description |
|---|---|---|
|
user |
Home pose (used in some examples, optional). |
|
user |
Start and end poses of vision systems 1 - 8 ( |
|
- |
Reserved. |
|
module |
Calibration result pose from |
|
module |
Object pose from |
|
module |
Joint waypoints of the trajectory segment being executed (up to 100 per segment). Filled by |
3.1.6 Info data
Info data are stored in numeric registers. R[20] - R[28] and R[32] hold real values. A register keeps its value until a new response contains the same key.
Key |
Info data |
Register |
Unit in robot |
|---|---|---|---|
1 |
Tool point invariance |
|
index |
2 |
Gripping point ID |
|
index |
3 |
Gripping point invariance |
|
index |
4 |
Dimension X |
|
mm |
5 |
Dimension Y |
|
mm |
6 |
Rotation Z |
|
deg (converted from mrad) |
7 |
Neural network label |
|
integer |
8 |
Max Z height |
|
mm |
9 |
Tilt |
|
deg (converted from mrad) |
10 |
Calibration accuracy |
|
mm (converted from µm) |
11 |
Running solution ID |
|
integer |
12 |
Number of localized objects |
|
integer |
13 |
Number of ready objects |
|
integer |
14 |
Processing state |
|
0 / 1 |
3.1.7 Error codes
The error code of the last request is stored in R[18]. The Error codes page describes the meaning of each code and how to fix the error. The KAREL programs use the following constant names:
Constant in |
Value |
Meaning |
|---|---|---|
|
0 |
|
|
1 |
|
|
3 |
Communication error - socket error, wrong response, checksum error or no response within 30 s. Set by the Robot module. |
|
4 |
Bad data - invalid frame number in |
|
6 |
Trajectory segment longer than 100 waypoints. Set by the Robot module. |
|
7 |
|
|
8 |
|
|
200 |
|
|
201 |
|
|
202 |
|
|
203 |
|
|
218 |
|
|
219 |
|
|
220 |
|
|
221 |
|
|
222 |
|
|
255 |
|
|
450 - 459 |
|
|
460 - 469 |
Other codes from the vision controller (for example calibration point errors or No valid license (471)) are written to R[18] unchanged.
3.2 Example programs
The example programs show the correct use of the robotic API. They contain only basic error handling. Add the error handling that your application needs. Before you run an example, touch up its positions (P[...]) and the start / end PRs.
Example program |
Purpose |
|---|---|
|
Basic bin picking with a cell-mounted scanner: initialize one vision system, scan, request and receive the trajectory, pick, repeat. |
|
Same as |
|
Two vision systems ( |
|
Solution requests: get the running solution, stop it, start solution |
|
Change scene state: activates scene state |
|
Change bounding box: switches |
|
Requests the object pose ( |
|
Calls |
|
Multiview: the robot stops at several poses and captures a scan at each one ( |
|
Multiview with dynamic meshing (MotionCam-3D only): with |
|
Two vision systems: VS1 is scanned, VS2 localizes on the same scan with |
|
Same as |
|
Automatic calibration from the robot: start, 9 calibration points, save, stop. |
|
Calibration template for a cell-mounted scanner, see Calibration example. |
|
Same as |
3.2.1 Basic bin picking example
PHO_MAIN_BASIC starts the Robot State Server, connects to the vision controller and initializes vision system 1 with start pose PR[2] and end pose PR[3]. Then it runs a loop: scan, request and receive a trajectory, pick the object. While the robot places the object, the next scan is already running.
1: !Clear Registers ;
2: CALL PHO_CLEAR_VARS ;
3: ;
4: !Start State Server ;
5: CALL PHO_RUN_STATE ;
6: ;
7: LBL[1] ;
8: !Start Phoclient ;
9: RUN PHOCLIENT ;
10: WAIT (F[1]=ON) ;
11: ;
12: !Set Vision system ID ;
13: R[30]=1 ;
14: !Assign ID values of P registers ;
15: !containing start & end poses ;
16: R[4]=2 ;
17: R[5]=3 ;
18: !Initialize Binpicking ;
19: CALL PHO_INIT ;
20: !Check error ;
21: IF (R[18]<>0) THEN ;
22: MESSAGE[PHO: Init VS failed] ;
23: ABORT ;
24: ENDIF ;
25: ;
26: LBL[2] ;
27: !Move to Scanning Position ;
28:J P[1] 20% FINE ;
29: !Request First Scan ;
30: CALL PHO_REQ_SCAN ;
31: ;
32: !Main Loop ;
33: LBL[3] ;
34: !Wait For Scan ;
35: CALL PHO_WAIT_SCAN ;
36: ;
37: !Request trajectory ;
38: CALL PHO_TRAJ_REQ ;
39: !Move to Start Position ;
40:J PR[2] 100% FINE ;
41: ;
42: !Receive Trajectory ;
43: CALL PHO_TRAJ_RECV ;
44: ;
45: !Error handling ;
46: SELECT R[18]=0,JMP LBL[4] ;
47: !VS not initialized ;
48: =203,JMP LBL[10] ;
49: !Empty scene error ;
50: =218,JMP LBL[2] ;
51: !Path planning failed ;
52: =201,JMP LBL[2] ;
53: !No part found ;
54: =202,JMP LBL[2] ;
55: !Abort program due to fatal error ;
56: !or logical error in program ;
57: ELSE,JMP LBL[10] ;
58: ;
59: LBL[4] ;
60: !Pick Part ;
61: CALL PHO_PICK_PART ;
62: !Your placing procedure ;
63: //J P[...] 100% FINE ;
64: ;
65: !Move to Scanning Position ;
66:J P[2] 20% FINE ;
67: !Request Next Scan ;
68: CALL PHO_REQ_SCAN ;
69: JMP LBL[3] ;
70: ;
71: !Abort program execution ;
72: LBL[10] ;
73: MESSAGE[Aborting Program] ;
74: MESSAGE[Check BPS For Error] ;
75: ABORT ;
3.2.2 Multiple vision systems example
PHO_MAIN_BASIC_MULTI_VS initializes two vision systems: VS1 with R[4]=2, R[5]=3 and VS2 with R[4]=4, R[5]=5. Before PHO_TRAJ_RECV, the robot moves to the start pose of the active vision system (PR[2] or PR[4]). After each pick, the program switches R[30] to the other vision system and requests a new scan.
PHO_MAIN_REUSE_SCAN has the same structure, but the second vision system uses PHO_REQ_REUSE_SCAN instead of a new scan.
3.2.3 Change solution example
PHO_MAIN_CHANGE_SOL shows how to control the deployed solution from the robot:
PHO_REQ_RUN_SOL- reads the running solution intoR[31].PHO_REQ_STOP_SOL- stops it.R[31]=101andPHO_REQ_START_SOL- starts solution 101.Bin picking as in
PHO_MAIN_BASIC.After each pick, the program switches
R[31]between 101 and 102, andPHO_CHANGE_SOLchanges the solution. Then the program jumps back toPHO_INIT, because the vision system must be initialized again after a solution change.
Use your own solution IDs from the Studio.
3.2.4 Calibration example
Calibration needs the Robot State Server with the correct R[33] / R[34] values (see Changing the Cartesian origin of the robot). The Studio reads the robot pose from the server when a calibration point is added. For the Studio side, see Calibration.
PHO_CALIBRATION_STATIC and PHO_CALIBRATION_HAND_EYE work as follows:
The program calls
PHO_CLEAR_VARS, starts the Robot State Server (PHO_RUN_STATE) and runsRUN PHOCLIENT.Automatic calibration only (lines 16 - 28, remarked by default):
PHO_CALIB_STOPstops a running calibration,R[31]= solution ID,R[30]= vision system ID,PHO_CALIB_STARTstarts the calibration.The robot moves to the calibration start pose and then to 9 calibration poses. At each pose
PHO_CALIB_ADDadds a calibration point.The robot moves to the calibration end pose.
Automatic calibration only (remarked by default):
PHO_CALIB_SAVEsaves the result (accuracy inR[32], result pose inPR[19]),PHO_CALIB_STOPends the calibration.
First calibration: Start the calibration in the Studio. Run the template and leave the remarked lines remarked. Check the result and save it in the Studio.
Automatic recalibration: After the first calibration is saved and automatic calibration is enabled for the vision system in the Studio, un-remark the start and save / stop lines. The calibration object must stay where it was during the first calibration. The calibration ball stays mounted in the same place on the flange or gripper and moves with the robot. The marker pattern stays in the same place in the cell. PHO_CALIBRATION is the same template with these lines already active (solution ID 1, vision system 1).
Teach the calibration poses so that the calibration object is clearly visible and the poses differ in position and orientation. As a general rule, a calibration error above 3 mm shows a systematic problem (wrong UFRAME / UTOOL, wrong robot model or base offset).
3.3 Error handling
After every synchronous request and every program that receives a response, check R[18: PHO ERROR DATA]. The examples show a basic SELECT R[18] block after PHO_TRAJ_RECV.
What PHOCLIENT does after an error:
Error code |
|
Main program |
|---|---|---|
201, 202, 218, 221, 453, 454, 458, 461 - 463, and codes not listed in this table (for example 200, 471, calibration point errors) |
Keeps the connection and waits for the next request. |
Handle the error (for example scan again) and continue. |
1, 3, 4, 6, 7, 8, 203, 219, 220, 222, 255, 450 - 452, 455, 457, 459, 460, 464 - 469 |
Closes the connection, sets |
Fix the cause, then |
Communication error (3) is reported when the socket fails, the response does not match the request, a checksum is wrong or no data arrives for 30 s. PHOCLIENT also sets F[4] when it ends. This way, a waiting TP program continues and can read R[18]. Do not call request programs while F[1] is OFF. Otherwise, they wait until PHOCLIENT accepts the request.
Note: The basic examples stop with ABORT for all errors except 201, 202 and 218. To recover from a lost connection without aborting, jump back to RUN PHOCLIENT (label LBL[1] in the examples).
3.4 Robot State Server
Calibration, hand-eye scanning, multiview and the robot visualization in the Studio need the current robot state. The KAREL program PHOSTATE sends it:
TCP/IP server on Host Comm tag S3, port 11004 (written to
$HOSTS_CFG[3].$SERVER_PORTbyPHOSTATE).After the vision controller connects, the server sends the brand ID. Then it sends, 10 times per second, the joint positions (rad) and the robot pose (mm, rad) in the frames selected by
R[33]/R[34]. Changes ofR[33]/R[34]take effect immediately.If the robot has a linear track (RTU) mapped to X or Y, the track position is subtracted from the reported pose.
F[3]is ON whilePHOSTATEruns.
Starting: Use CALL PHO_RUN_STATE at the beginning of the main program, or run PHO_RUN_STATE alone (select it and press SHIFT + FWD). PHO_RUN_STATE first stops a running PHOSTATE so that the new R[33] / R[34] values are used.
1: !KILL State server ;
2: F[9]=(ON) ;
3: WAIT 1.00(sec) ;
4: !Turn PHOSTATE KILL flag OFF ;
5: F[9]=(OFF) ;
6: !Turn MNUFRAME ON/OFF ;
7: F[10]=(OFF) ;
8: !Set MNUFRAME for State Server ;
9: R[33]=1 ;
10: !Set MNUTOOL for State Server ;
11: R[34]=1 ;
12: !Start PHOSTATE ;
13: IF (F[3]=OFF) THEN ;
14: RUN PHOSTATE ;
15: ENDIF ;
The USER screen shows the controller version, the module version, the IP addresses and the connection state:
Stopping: Abort All does not stop PHOSTATE. To stop it, set F[9: PHO STATE KILL] to ON. PHOSTATE stops in its next cycle. If no client is connected, it stops when the next client connects. PHO_RUN_STATE resets F[9].
When the vision controller disconnects, PHOSTATE waits for a new connection. If the vision controller cannot be pinged anymore, PHOSTATE stops. In this case, check the cabling and run PHO_RUN_STATE again.
Note: Do not set PHO_RUN_STATE as a HOT START or COLD START autoexec program. PHOSTATE might not start correctly, especially on V9.
3.5 Version and brand ID
Robot module version: BPS 1.12.1 (shown as
BPS 1.12.1/B1on the USER screen and in the comment of the KAREL and TP programs).Brand ID:
___FANUC/__F.__1._12.__0
The brand ID still contains 1.12.0 because this is the version of the communication interface, not of the Robot module. The FANUC Robot module 1.12.1 works with every BPS 1.12.x. Both PHOCLIENT and PHOSTATE send the brand ID directly after the connection is established.
4 Running the basic bin picking example program
4.1 Prerequisites
Before you run the Basic bin picking example, make sure that:
A BPS solution with one vision system is prepared and calibrated.
The robot controller is configured as described in Robot controller setup and ping works in both directions.
The scanning poses
P[1]/P[2]and the start and end posesPR[2]/PR[3]are taught (see Reteach the robot poses).The gripper programs are implemented (optional - without them, the robot does not actually pick the object).
The placing procedure is implemented (line 63 of the example).
4.2 Bin picking routine execution settings
PHO_PICK_PART calls PHO_EXE_TRAJ for every trajectory segment of the bin picking routine. Lines 1 - 21 set the speed R[2] (in %) of each segment by its number R[1]. By default, four segments are configured (start -> approach -> grasp -> deapproach -> end). If your grasping method has more segments, add more IF blocks. Keep the order of the segments in mind.
Warning: Do not edit lines 23 - 33!
1: !Binpicking speed config ;
2: ;
3: !1.Segment ;
4: IF (R[1]=1) THEN ;
5: R[2]=100 ;
6: ENDIF ;
7: ;
8: !2.Segment ;
9: IF (R[1]=2) THEN ;
10: R[2]=50 ;
11: ENDIF ;
12: ;
13: !3.Segment ;
14: IF (R[1]=3) THEN ;
15: R[2]=50 ;
16: ENDIF ;
17: ;
18: !4.Segment ;
19: IF (R[1]=4) THEN ;
20: R[2]=100 ;
21: ENDIF ;
22: ;
23: !Execute trajectory ;
24: FOR R[3]=21 TO R[13] ;
25:J PR[R[3]] R[2]% CNT100 ;
26: ENDFOR ;
27: ;
28: !Last Point FINE/CNT ;
29: IF (R[16]=0) THEN ;
30:J PR[R[14]] R[2]% CNT100 ;
31: ELSE ;
32:J PR[R[14]] R[2]% FINE ;
33: ENDIF ;
4.3 Reteach the robot poses
Teach the scanning pose outside the field of view of the scanner (for a hand-eye scanner: the pose from which the bin is scanned). Teach the start pose with the gripper approximately above the center of the bin. The end pose can be similar to the start pose or slightly shifted towards the placing area. Do not put the end pose too far from the bin. This makes path planning slower and can cause planning errors.
Open Data, press F1[TYPE] -> Position Reg:
Jog the robot to the pose, select the register and press SHIFT + F3[RECORD]:
Start and end poses must be in Joint representation. Press F4[POSITION] -> F5[REPRE] -> Joint and confirm with CONTINUE. Do this for all start and end poses:
PHO_INIT sends the PRs to the Studio. Before the call, set R[4] / R[5] to the PR numbers.
4.4 Runtime
Deploy your BPS solution. On the Deployment page, the Action Request Client status is DISCONNECTED until the robot connects.
Press Select, choose PHO_MAIN_BASIC and start it in T1 (hold the deadman switch and press SHIFT + FWD):
The USER screen shows the messages of PHOSTATE and PHOCLIENT. When the connection is established, Action Request Client and Robot State Server on the Deployment page change to CONNECTED and the first scan starts. When the first trajectory is received, the robot starts moving (PR[21] and higher contain the waypoints of the segment being executed).
Warning: Be ready to stop the robot at any time. Reduce the speed to 10 % for the first tests.
If the robot is too far from the object or pushes it too deep, adjust the gripping points or the tool in the Studio. To stop the program, use Function -> Abort All. This also aborts PHOCLIENT.
5 Migration guide
Read the general migration guide Migration from BPS 1.11.x to BPS 1.12.x first. Changes specific to the FANUC Robot module:
1.11 -> 1.12.0: Info data are read by their key (
oper_num).R[26]-R[28]now hold NN label, max Z height and tilt (see Info data). The NN label is stored without conversion.1.12.0 -> 1.12.1:
F[10]is deprecated -R[33]/R[34]always apply and accept0(World / bare faceplate). Invalid frame numbers no longer stop the KAREL programs. The scaling of the extended axis (rail) in received trajectories is fixed.PHOCLIENTandPHOSTATEno longer change$GROUP[1].$UFRAME/$UTOOL. The brand ID is unchanged.Update procedure: Robot module update.
5.1 Robot module update
Back up all programs you have changed (for example
PHO_GRIP_ATTorPHO_EXE_TRAJ) and your main programs.Set
F[9]to ON to stopPHOSTATE, then abort all programs.Delete the old TP programs of the Robot module and
PHOCLIENT.PC/PHOSTATE.PC(and their variables).Load the new files as described in Loading the Robot module files.
Copy your changes into the new programs.
Check the register list and the migration notes above and update your main program if needed.